//
//  CalendarViewController.m
//  Light
//
//  Created by 骁唐 on 15/9/8.
//  Copyright (c) 2015年 骁唐. All rights reserved.
//

#import "CalendarViewController.h"
#import "FDCalendar.h"
#import "AppDelegate.h"

#import "NetworkTool.h"
#import "AFNetworking.h"
#import "UMSocial.h"

@interface CalendarViewController ()
@property (weak, nonatomic) IBOutlet UIView *myCalendarView;
@property (weak, nonatomic) IBOutlet UIImageView *backGround;

@end

@implementation CalendarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
    
    FDCalendar *calendar = [[FDCalendar alloc] initWithCurrentDate:[NSDate date]];
    CGRect frame = calendar.frame;
    frame.origin.y = 0;
    calendar.frame = frame;
    calendar.backgroundColor = [UIColor clearColor];

    /*
     reportDuration = "<null>";
     reportID = 172;
     uploaddate = "2016-01-05T00:00:00";
     */
//    NSMutableArray * arrayData = [[NSMutableArray alloc] initWithCapacity:0];
//    for (NSDictionary * dic in self.bArray)
//    {//SXW__日历数据过滤，如果报告为空，则过滤掉
//        if (![TJJDefines isNull:[dic objectForKey:@"reportDuration"]])
//        {//如果数据报告不为空，则添加进来
//            [arrayData addObject:dic];
//        }
//    }
    
    //传值
    calendar.centerCalendarItem.bArray = self.bArray;
    calendar.leftCalendarItem.bArray = self.bArray;
    calendar.rightCalendarItem.bArray = self.bArray;
    [self.myCalendarView addSubview:calendar];
   
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
- (IBAction)backClick {
    [self dismissViewControllerAnimated:YES completion:nil];
  
}

-(void)viewWillAppear:(BOOL)animated
{
    //强制竖屏
    [[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:
                                        UIInterfaceOrientationPortrait]  forKey:@"orientation"];
    long long int currentTimeInt = [TJJDefines getTimeIntSince1970Current];
    if (currentTimeInt>=16200&& currentTimeInt <=34200) {
        self.backGround.image = [UIImage imageNamed:@"backgroundOne"];
    }else if (currentTimeInt>34200 && currentTimeInt<=55800)
    {
        self.backGround.image = [UIImage imageNamed:@"backgroundTwo"];
    }else if (currentTimeInt>55800 && currentTimeInt<=70200)
    {
        self.backGround.image = [UIImage imageNamed:@"backgroundThree"];
    }else if(currentTimeInt >70200 || currentTimeInt<16200)
    {
        self.backGround.image = [UIImage imageNamed:@"background_night"];
    }
}

@end
